let lastOptionTime = new Date().getTime();// 初始化最后操作时间
let currentTime = new Date().getTime();// 初始化当前操作时间
let timeOut = 0.7*60*1000;
window.onload = function(){
    window.document.onmousedown = function(){
        let token = window.localStorage.getItem('token')
        lastOptionTime = Number(window.localStorage.getItem('lastOptionTime'))
    
        if(token&&lastOptionTime){
            console.log(1);
            currentTime = new Date().getTime()
            if(currentTime-lastOptionTime>timeOut){
                console.log(2);
                
            }else{
                console.log(3);
                window.localStorage.setItem('lastOptionTime',new Date().getTime().toString())
                
            }
        }else{
            if(token){
                console.log(4);
                window.localStorage.setItem('lastOptionTime',new Date().getTime().toString())
                
            }else{
                console.log(5);
                if(window.location.pathname=='/login')return;
                window.location.pathname = '/login'
                
            }
        }
    }
}